import Vue from "https://cdn.skypack.dev/vue@2.6.14/dist/vue.min.js";
import render from "../packages/Editor/dist/index.js";
let graph;
new Vue({
    el: "#app",
    data() {
        return {
            editingNode: {
                node: {},
                visible: false,
            },
        };
    },
    async mounted() {
        graph = render({ containerID: "container" });
        const data = JSON.parse(localStorage.getItem("data"));

        graph.fromJSON(data);
        graph.on("node:dblclick", ({ node }) => {
            this.editingNode.node = node.attr().data;
        });
    },
    methods: {
        saveGraph() {
            const data = graph.toJSON();
            localStorage.setItem("data", JSON.stringify(data));
            console.log(data);
        },
        // 将导出的属性转化为树状结构
    },
});
